{template 'common/header-storex'}
<div class="wn-main">
	<div class="wn-main__head">规格管理</div>
	<div class="wn-main__content">
		<div class="wn-tabs">
			<div class="wn-tabs__item wn-tabs__item--active">
				<a class="wn-tabs__link" href="{php echo $this->createWebUrl('shop_spec', array('op' => 'display', 'storeid' => $_GPC['storeid']))}">规格列表</a>
			</div>
		</div>
		{if $op == 'display'}
		<div class="wn-main__search clearfix">
			<div class="wn-main__search__action">
				<a href="{php echo $this->createWebUrl('shop_spec', array('op' => 'post', 'storeid' => $storeid));}" id="add_coupon" class="btn btn-primary we7-padding-horizontal">+添加规格</a>
			</div>
		</div>
		<table class="table table-hover wn-table table-bordered">
			<thead class="navbar-inner">
				<tr>
					<th>规格名称</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $spec_list $item}
			<tr>
				<td>{$item['name']}</td>
				<td>
					<div class="wn-table__link">
						<a class="wn-table__link__item" href="{php echo $this->createWebUrl('shop_spec_value', array('op' => 'display', 'id' => $item['id'], 'storeid' => $storeid))}">设置规格值</a>
						<a class="wn-table__link__item" href="{php echo $this->createWebUrl('shop_spec', array('op' => 'post', 'id' => $item['id'], 'storeid' => $storeid))}">编辑</a>
						<a class="wn-table__link__item" href="javascript:;" onclick="drop_confirm('您确定要删除吗?', '{php echo $this->createWebUrl('shop_spec',array('op' => 'delete', 'id' => $item['id'], 'storeid' => $storeid))}');">删除</a>
					</div>
				</td>
			</tr>
			{/loop}
		</table>
		{/if}

		{if $op == 'post'}
		<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
			<input type="hidden" name="id" value="{$spec_info['id']}">
			<input type="hidden" name="store_type" value="{$store['store_type']}">
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">规格名称</label>
				<div class="col-sm-9 col-xs-12">
					<input type="text" name="name" id="name" value="{$spec_info['name']}" class="form-control">
				</div>
			</div>
			<div class="form-group col-sm-12">
				<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
				<input type="hidden" name="token" value="{$_W['token']}" />
			</div>
		</form>
		{/if}
	</div>
</div>

<script type="text/javascript">
	function drop_confirm(msg, url) {
		if (confirm(msg)) {
			window.location = url;
		}
	}
</script>
{template 'common/footer-storex'}